from selenium.webdriver.common.keys import Keys

import page
from base.app_base import AppBase
import time
from tools.get_log import GetLog
logger = GetLog.get_logger()


class ZoPageSearchCheck(AppBase):
    # 1.点击全局搜索按钮，进入全局搜索
    def page_click_search_button(self):
        time.sleep(0.5)
        self.base_click(page.zo_serarch_button)
        time.sleep(0.5)
        self.base_input(page.zo_search_input, '基金')
        time.sleep(0.5)
        self.base_click(page.zo_search_input)
        self.driver.keyevent(66)
        time.sleep(1)

    # 2.查找TAB标签
    def page_click_tab(self, click_text):
        # 1.调佣从右向左滑动方法
        self.app_base_right_wipe_left(page.zo_search_tab_area, click_text)

    # 3.查找内容
    def page_click_content(self, title):
        self.app_base_down_wipe_up(page.zo_search_content_area, title)

    # 4.全局搜索业务方法
    def zo_page_search_check(self, click_text, title):
        logger.info('正在调用全局搜索业务方法，查找的Tab标签是：{} 查找的内容是:{}'.format(click_text, title))
        self.page_click_search_button()
        self.page_click_tab(click_text)
        self.page_click_content(title)

